package com.gitee.dengmin.tenant.controller;

import com.gitee.dengmin.tenant.constants.TenantMap;
import com.gitee.dengmin.tenant.mapper.UserMapper;
import com.gitee.dengmin.tenant.models.User;
import com.gitee.dengmin.tenant.response.ApiResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class IndexController {

    @Resource
    private UserMapper userMapper;

    @GetMapping("/test")
    public Object test(){
        return TenantMap.getMap();
    }

    @GetMapping("/users")
    public ApiResult<List<User>> getUsers(){
        List<User> users = userMapper.selectList(null);
        return ApiResult.ok(users);
    }


}
